function Planet(size,speed,directory,color,which)
{
	this.size=size;
	this.speed = speed;
	this.directory = directory;//true-right,false-left
	this.color = "#"+color;
	this.angle=0;
        this.which = which;//tells then index of the planet in the system
        
        this.draw = function(context,loop)
        {
            var c = context;
            if( !loop )
            {
                c.lineWidth="1";
//counting the edges for line to be drawn
                var lineLength = Math.sqrt( ( canvas.width/2*canvas.width/2 ) + ( canvas.height/2*canvas.height/2 ) );
                var lineEndX = lineLength * Math.sin( this.angle );
                var lineEndY = lineLength * Math.cos( this.angle );
//setting starting point for the line, which is the middle of th planet             
                var orbitSize = 7+this.which*6 ;       
                var startingX = orbitSize*Math.sin( this.angle );
                var startingY = orbitSize*Math.cos( this.angle );
                
                c.strokeStyle=this.color;
                c.beginPath();
                c.moveTo(startingX,startingY);        
                c.lineTo(lineEndX,lineEndY);
                c.stroke();                
            }
            
            
            c.lineWidth="1";             
            var orbitSize = 7+this.which*6 ;   
//the orbit
            c.strokeStyle= this.color ;
            c.beginPath();
            c.arc(0,0,orbitSize,0,Math.PI*2);
            c.stroke();
//the planet
            var x = orbitSize*Math.sin( this.angle );
            var h = orbitSize*Math.cos( this.angle );
            c.fillStyle= this.color ;
            c.beginPath();
            c.arc(x,h,this.size,0,Math.PI*2);
            c.fill();
        }
}